package com.zoe.app.controller;

import com.zoe.app.dao.UserDao;
import com.zoe.app.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Zoe.Zhang
 * @date 2021/10/11
 * @description
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private UserDao userDao;

    @GetMapping("/getUserById/{id}")
    public String getUserById(@PathVariable("id") Integer id) {
        return userService.getUserById(id);
    }

    @DeleteMapping("/delUserById/{id}")
    public String delUserById(@PathVariable("id") Integer id) {
        return userService.delUserById(id);
    }

    @GetMapping("/getUsers")
    public List getUsers() {
        return userDao.getUsers();
    }
}
